function updatecell(i,j)

global cells cost

sum = cells(i-1,j) + cells(i+1,j) + cells(i,j-1) + cells(i,j+1) + cells(i,j);
cells(i,j) = sum/5;

%sum = cost(i-1,j) + cost(i+1,j) + cost(i,j-1) + cost(i,j+1) + cost(i,j);
%cost(i,j) = sum/5;


end